home *** CD-ROM | disk | FTP | other *** search
- /*
- (C) 1995-96 AROS - The Amiga Replacement OS
- $Id: path.c,v 1.3 1996/09/13 17:52:11 digulla Exp $
- $Log: path.c,v $
- Revision 1.3 1996/09/13 17:52:11 digulla
- Use IPTR
-
- Revision 1.2 1996/08/01 17:40:45 digulla
- Added standard header for all files
-
- Desc:
- Lang:
- */
- #include <exec/memory.h>
- #include <clib/exec_protos.h>
- #include <dos/dosextens.h>
- #include <clib/dos_protos.h>
-
- CALLENTRY /* Before the first symbol */
-
- struct ExecBase *SysBase;
- struct DosLibrary *DOSBase;
-
- static LONG tinymain(void);
-
- LONG entry(struct ExecBase *sysbase)
- {
- LONG error=RETURN_FAIL;
- SysBase=sysbase;
- DOSBase=(struct DosLibrary *)OpenLibrary("dos.library",39);
- if(DOSBase!=NULL)
- {
- error=tinymain();
- CloseLibrary((struct Library *)DOSBase);
- }
- return error;
- }
-
- static LONG tinymain(void)
- {
- struct RDArgs *rda;
- IPTR args[6]={ 0, 0, 0, 0, 0, 0 };
-
- rda=ReadArgs("PATH/M,ADD/S,SHOW/S,RESET/S,REMOVE/S,QUIET/S",args,NULL);
- if(rda!=NULL)
- {
- STRPTR *names=(STRPTR *)args[0];
- BPTR *cur, *next;
- struct CommandLineInterface *cli;
- cli=Cli();
- cur=(BPTR *)BADDR(cli->cli_CommandDir);
- while(cur)
- {
- next=(BPTR *)cur[0];
- UnLock(cur[1]);
- FreeVec(cur);
- cur=next;
- }
- cur=&cli->cli_CommandDir;
- while(*names!=NULL)
- {
- next=(BPTR *)AllocVec(2*sizeof(BPTR),MEMF_ANY);
- next[1]=Lock(*names,SHARED_LOCK);
- if(!next[1])
- {
- FreeVec(next);
- break;
- }
- cur[0]=MKBADDR(next);
- cur=next;
- if(!args[5])
- VPrintf("%s added.\n",(ULONG *)names);
- names++;
- }
- cur[0]=0;
- FreeArgs(rda);
- }
- return 0;
- }
-